package com.xxkk.gameCore.enums;

public enum ErrorCode {

	normalErrorCode(0,ErrorType.ExcuterError),
	alreadyExistsUser(1,ErrorType.ExcuterError,"注册失败,用户已存在"),
	noUser(4,ErrorType.LogicError,"修改用户信息失败,用户不存在"),
	sqlException(2,ErrorType.ExcuterError,"sql异常"),
	ServerException(3,ErrorType.ExcuterError,"服务器异常"),
	jsonTransformError(5,ErrorType.LogicError,"json字符串转换错误"),
	accountCheckedError(6,ErrorType.LogicError,"登陆账号验证失败"),
	noArea(7,ErrorType.LogicError,"本服务器不存在该区"),
    ;

	public final int code;
	public ErrorType errorType;
	public String msg;

	private ErrorCode(int code) {
		this.code = code;
	}

	ErrorCode(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	ErrorCode(int code, ErrorType errorType, String msg) {
		this.code = code;
		this.errorType = errorType;
		this.msg = msg;
	}
	ErrorCode(int code, ErrorType errorType) {
		this.code = code;
		this.errorType = errorType;
	}

	public int getCode() {
		return code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public ErrorType getErrorType() {
		return errorType;
	}

	public void setErrorType(ErrorType errorType) {
		this.errorType = errorType;
	}

	@Override
	public String toString() {
		return "ErrorCode{" +
				"code=" + code +
				", errorType=" + errorType +
				", msg='" + msg + '\'' +
				'}';
	}
}
